﻿namespace Foggy.Data.Settings
{
    using System.Data.Entity.ModelConfiguration;

    /// <summary>
    /// Settings configuration
    /// </summary>
    public class SettingsConfiguration : EntityTypeConfiguration<SettingDto>
    {
        /// <summary>
        /// The maximum length allowed in the name field
        /// </summary>
        public const int NameMaxLength = 40;

        /// <summary>
        /// The maximum length allowed int the value field
        /// </summary>
        public const int ValueMaxLength = 1000;

        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsConfiguration"/> class.
        /// </summary>
        public SettingsConfiguration()
        {
            this.ToTable("Settings");
            Property(p => p.Name).HasColumnName("Name").HasMaxLength(NameMaxLength);
            Property(p => p.Value).HasColumnName("Value").HasMaxLength(ValueMaxLength);
        }
    }
}